﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace spline
{
    class Newton
    {
        public static double Solve(string func, double a, double b, double eps)
        {
            double x = a;
            double f;
            double f1, h;
            do {
                f = Functions.f(func, x);
                f1 = Functions.derivate(func, x);
                h = f / f1;
                x = x - h;
            } while (Math.Abs(h) >= eps);
            return x;
        }
    }
}
